package com.atguigu.day18.lambda04.l2;

import org.junit.Test;

import java.util.HashMap;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
/*
有一个形参,可以省略
 */
public class SetAndMap {

    @Test
    public void test02(){

        HashMap<String,String>map = new HashMap<>();
        map.put("射手","孙尚香");
        map.put("打野","孙悟空");
        map.put("法师","张良");
        map.put("辅助","孙膑");

       /* map.forEach(new BiConsumer<String, String>() {
            @Override
            public void accept(String k, String v) {

                System.out.println(k+","+v);

            }
        });*/

       map.forEach((k,v)->
           System.out.println(k+"-"+v)
       );


    }

    @Test
    public void test01(){

        Set<String> set = Set.of("张三", "李四", "王五", "赵六");

       /* set.forEach(new Consumer<String>() {
            @Override
            public void accept(String s) {
                System.out.println("s = " + s);
            }
        });*/

        set.forEach(c-> System.out.println(c));
    }
}
